// 文件流转html
export default function arraybuffer2html(url, options = {}) {
  return new Promise(resolve => {
    let xhr = new XMLHttpRequest()
    xhr.open("GET", url, true)
    // 设置请求头类型
    xhr.setRequestHeader("Content-type", "application/json")

    xhr.responseType = "arraybuffer"

    xhr.onload = function () {
      mammoth.convertToHtml({ arrayBuffer: new Uint8Array(xhr.response) })
        .then(function (resultObject) {
          console.log(resultObject)
          resolve(resultObject.value)
        }, options)
    }

    xhr.send()
  })
}